package com.zhuang.chapter07.work01;

public class HourlyEmployee extends Employee {
	// 每小时的工资
	private int hourSalary;
	// 每月工作的小时数
	private int workHour;

	public HourlyEmployee(String name, int month, int hourSalary, int workHour) {
		super(name, month);
		this.hourSalary = hourSalary;
		this.workHour = workHour;
	}

	public int getHourSalary() {
		return hourSalary;
	}

	public void setHourSalary(int hourSalary) {
		this.hourSalary = hourSalary;
	}

	public int getWorkHour() {
		return workHour;
	}

	public void setWorkHour(int workHour) {
		this.workHour = workHour;
	}

	@Override
	public int getSalary(int month) {
		int salary = 0;
		if (this.workHour > 160) {
			salary = (int) ((160 + (this.workHour - 160) * 1.5) * this.hourSalary);
		} else {
			salary = workHour * hourSalary;
		}
		return salary + super.getSalary(month);
	}
}
